package com.morehair.controller.wx;

import com.morehair.bean.bo.admin.CreateGoodsBo;
import com.morehair.bean.bo.wx.ListOfGoodsBo;
import com.morehair.bean.vo.admin.BaseRespVo;
import com.morehair.bean.vo.wx.*;
import com.morehair.service.wx.WxGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description: 前台商品
 * Date: 2021/6/9
 * Time: 10:11
 * author: zhang wei
 */

@RestController
@RequestMapping("wx/goods")
public class WxGoodsController {

    @Autowired
    WxGoodsService wxGoodsService;

    @RequestMapping("count")
    public BaseRespVo totalOfGoods() {
        TotalOfGoodsVo totalOfGoodsVo = wxGoodsService.totalOfGoods();
        return BaseRespVo.ok(totalOfGoodsVo);
    }

    @RequestMapping("category")
    public BaseRespVo category(Integer id) {
        CategoryInHomeVo category = wxGoodsService.lookCategory(id);
        return BaseRespVo.ok(category);
    }

    @RequestMapping("list")
    public BaseRespVo getList( ListOfGoodsBo listOfGoodsBo) {
        ListOfGoodsVo listOfGoodsVo = wxGoodsService.getList(listOfGoodsBo);
        return BaseRespVo.ok(listOfGoodsVo);
    }

    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        DetailOfGoodsDataVo detailOfGoodsDataVo = wxGoodsService.getGoodsDetail(id);
        return BaseRespVo.ok(detailOfGoodsDataVo);
    }

    @RequestMapping("related")
    public BaseRespVo related(Integer id) {
        RelatedDataVo relatedDataVo = wxGoodsService.getRelated(id);
        return BaseRespVo.ok(relatedDataVo);
    }

}
